#include "command.h"

int _pwd(char *argv[])
{
	/* check the number of cmd-line parameters is correct */
	int argc = 0;
	for (char **ptr = argv; *ptr != NULL; ptr++)
		argc++;

	if (argc != 1) {
		fprintf(stderr, "Usage: pwd\n");
		return -1;
	}

	char cwd[FILEPATH_SIZE];

	if (getcwd(cwd, sizeof(cwd)) != NULL) {
		printf("%sCurrent directory:%s %s\n", WHITE_HL, RESET, cwd);
	} else {
		fprintf(stderr, "pwd error: getcwd\n");
		return -1;
	}

	return 0;
}
